package vista.web.java;

import java.io.IOException;

import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class ClienteBuscar extends HttpServlet implements Servlet {

	@Override
	protected final void doPost(final HttpServletRequest req, final HttpServletResponse resp)
			throws ServletException, IOException {

		HttpSession sesion = req.getSession(false);
		// req.getSession(true); //si no hay seson, la genera nueva
		// req.getSession(false);//no queremos que se genere sesion nueva, si no
		// hay sesion o esta invalidada, devuelve null

		String combo = req.getParameter("combo");
		String consulta = req.getParameter("consulta");

//		req.setAttribute("combo", combo);
//		req.setAttribute("consulta", consulta);
		
			
		
		System.out.println("opcion " + combo);
		System.out.println("consulta " + consulta);
		
		System.out.println("doPost ClienteBuscar");
		
		getServletContext().getRequestDispatcher("/validacionBusqueda/index.html")
		.forward(req, resp);
		
//		resp.sendRedirect("../validacionBusqueda/index.html");
//		getServletContext().getRequestDispatcher("/validacionBusqueda/index.html").forward(req, resp);
		
//		resp.sendRedirect("/validacionBusqueda/index.html");
		
//		System.out.println(combo);
//		System.out.println(consulta);

	}

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}

	@Override
	public ServletContext getServletContext() {
		// TODO Auto-generated method stub
		return super.getServletContext();
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 3929570080828799648L;

}
